﻿<runtime:VisualPart
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:runtime="clr-namespace:ViewOnCore.Visual;assembly=ViewOnCore"
  xmlns:igDP="http://infragistics.com/DataPresenter"
  xmlns:igWindows="http://infragistics.com/Windows"
  xmlns:properties="clr-namespace:MusicPlayerAddIn.Properties"
  xmlns:control="clr-namespace:UI.Control"
  xmlns:wpf="clr-namespace:ViewOnCore.Helper.WPF;assembly=ViewOnCore"
  xmlns:dg="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit"
  x:Class="MusicPlayerAddIn.MusicPlayer">

    <runtime:VisualPart.Resources>

         <VisualBrush x:Key="mybrush"/>

        <CollectionViewSource x:Key="MusicViewContentDataSource"/>
        <CollectionViewSource x:Key="MusicViewGenresDataSource"/>
        <CollectionViewSource x:Key="MusicViewArtistsDataSource"/>
        <CollectionViewSource x:Key="MusicViewAlbumsDataSource"/>

        <!-- Context menu -->
        <ContextMenu x:Key="MusicDetailsViewContextMenuSingle">
            <MenuItem Header="{x:Static properties:Globalization.MusicPart_Play}"/>
            <MenuItem Header="{x:Static properties:Globalization.MusicPart_Remove}"/>
        </ContextMenu>
        <ContextMenu x:Key="MusicDetailsViewContextMenuSingleNoPlay">
            <MenuItem Header="{x:Static properties:Globalization.MusicPart_Remove}"/>
        </ContextMenu>
        <ContextMenu x:Key="MusicDetailsViewContextMenuMultiple">
            <MenuItem Header="{x:Static properties:Globalization.MusicPart_Remove}"/>
        </ContextMenu>

        <!-- Show / Hide buttons -->
        <Storyboard x:Key="importButtonShowStoryboard">
            <Storyboard>
                <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetName="btnImport" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>
        <Storyboard x:Key="importButtonHideStoryboard">
            <Storyboard>
                <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetName="btnImport" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>

        <Storyboard x:Key="controlShowStoryboard">
            <Storyboard>
                <DoubleAnimation To="1" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>
        <Storyboard x:Key="controlHideStoryboard">
            <Storyboard>
                <DoubleAnimation To="0" Duration="00:00:00.4000000" Storyboard.TargetProperty="Opacity" />
            </Storyboard>
        </Storyboard>

        <DataTemplate x:Key="CoverDataTemplate">
            <StackPanel Width="400" Height="400">
                <Border BorderBrush="LightGray"
                            BorderThickness="6"
                            Width="400"
                            Height="400"
                            Background="#ff333333">
                    <Image x:Name="image" Source="{Binding Path=BitmapSource}" Stretch="Fill" Margin="15,15,15,15" RenderOptions.BitmapScalingMode="Linear"/>
                    <Border.Effect>
                        <BlurEffect Radius="3" KernelType="Box"/>
                    </Border.Effect>
                </Border>
            </StackPanel>
        </DataTemplate>

    </runtime:VisualPart.Resources>

    <runtime:VisualPart.RenderTransform>
        <TransformGroup>
            <ScaleTransform ScaleX="1" ScaleY="1" />
            <RotateTransform Angle="0" />
            <TranslateTransform X="0" Y="0" />
        </TransformGroup>
    </runtime:VisualPart.RenderTransform>

    <Grid x:Name="griMain">

        <Grid.RowDefinitions>
            <RowDefinition Height="30"/>
            <RowDefinition Height="180"/>
            <RowDefinition Height="3"/>
            <RowDefinition Height="200*"/>
            <RowDefinition Height="1"/>
            <RowDefinition Height="158"/>
        </Grid.RowDefinitions>

        <!-- Tool bar -->
        <Border Grid.Row="0" Margin="2,2,2,2" Background="{DynamicResource VOColor11}" CornerRadius="1" Opacity="0.5"/>
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="7,0,7,0">
            <Button x:Name="btnBurn" Margin="5,2,5,2" Style="{DynamicResource Button.TransparentWithEffect2}" ToolTip="{x:Static properties:Globalization.MusicPart_TTBurn}">
                <StackPanel Orientation="Horizontal">
                    <wpf:Icon Source="/_images/PartMusic/burn.png" Width="18" Height="18"/>
                    <TextBlock Text="{x:Static properties:Globalization.MusicPart_Burn}" Margin="5,0,5,0" VerticalAlignment="Center"/>
				</StackPanel>
            </Button>
            <Button x:Name="btnCopyTo" Margin="5,2,5,2" Grid.Column="1" Style="{DynamicResource Button.TransparentWithEffect2}" ToolTip="{x:Static properties:Globalization.MusicPart_TTCopyTo}">
                <StackPanel Orientation="Horizontal">
                    <wpf:Icon Source="/_images/PartMusic/copy-to.png" Width="18" Height="18"/>
                    <TextBlock Text="{x:Static properties:Globalization.MusicPart_CopyTo}" Margin="5,0,5,0" VerticalAlignment="Center"/>
				</StackPanel>
            </Button>
            <Button x:Name="btnRemove" Margin="5,2,5,2" Grid.Column="1" Style="{DynamicResource Button.TransparentWithEffect2}" ToolTip="{x:Static properties:Globalization.MusicPart_TTRemoveSong}">
                <StackPanel Orientation="Horizontal">
                    <wpf:Icon Source="/_images/PartMusic/remove.png" Width="18" Height="18"/>
                    <TextBlock Text="{x:Static properties:Globalization.MusicPart_RemoveSong}" Margin="5,0,5,0" VerticalAlignment="Center"/>
				</StackPanel>
            </Button>
            <Button x:Name="btnImport" Style="{StaticResource Button.TransparentWithEffect2}" ToolTip="{x:Static properties:Globalization.MusicPart_TTImport}">
                <StackPanel Orientation="Horizontal">
                    <wpf:Icon Source="/_images/PartMusic/Import.png" Width="18" Height="18" Margin="1,1,1,1"/>
                    <TextBlock Text="{x:Static properties:Globalization.MusicPart_TTImport}" Margin="5,0,5,0" VerticalAlignment="Center"/>
				</StackPanel>
            </Button>
        </StackPanel>
        <StackPanel Grid.Row="0" Orientation="Horizontal" Margin="7,0,7,0" HorizontalAlignment="Right">
            <TextBox x:Name="txtSearch" Width="150" VerticalAlignment="Center"/>
            <Button x:Name="btnSearch" Style="{StaticResource Button.TransparentWithEffect2}" ToolTip="{x:Static properties:Globalization.MusicPart_TTSearch}" Margin="1,1,20,1">
                <wpf:Icon Source="/_images/PartMusic/Search.png" Width="18" Height="18" />
            </Button>

            <RadioButton Height="20" Style="{StaticResource RadioButton.Image}" GroupName="rbgViews" x:Name="rabViewDetails" Margin="2,0,0,0" ToolTip="{x:Static properties:Globalization.MusicPart_Tooltip_ViewDetails}">
                <wpf:Icon Width="18" Height="18" Source="/_images/PartMusic/ViewDetails.png"/>
            </RadioButton>
            <RadioButton Height="20" Style="{StaticResource RadioButton.Image}" GroupName="rbgViews" x:Name="rabViewTagsCloud" Margin="2,0,0,0" ToolTip="{x:Static properties:Globalization.MusicPart_Tooltip_ViewTagsCloud}">
                <wpf:Icon Width="18" Height="18" Source="/_images/PartMusic/ViewTagsCloud.png"/>
            </RadioButton>
            <RadioButton Height="20" Style="{StaticResource RadioButton.Image}" GroupName="rbgViews" x:Name="rabViewCoverFlow" Margin="2,0,0,0" ToolTip="{x:Static properties:Globalization.MusicPart_Tooltip_ViewCoverListDeep}">
                <wpf:Icon Width="18" Height="18" Source="/_images/PartMusic/ViewCoverListDeep.png"/>
            </RadioButton>
            <RadioButton Height="20" Style="{StaticResource RadioButton.Image}" GroupName="rbgViews" x:Name="rabViewKiosk" Margin="2,0,0,0" ToolTip="{x:Static properties:Globalization.MusicPart_Tooltip_ViewCheckerBoard}">
                <wpf:Icon Width="18" Height="18" Source="/_images/PartMusic/ViewKiosk.png"/>
            </RadioButton>
        </StackPanel>

        <!-- Tags cloud -->

        <control:TagsCloud x:Name="tcFilter" Grid.Row="1" Field="Artist" Visibility="Hidden"/>

        <!-- Filters -->
        <Grid x:Name="griFilters" Grid.Row="1">

            <Grid.RowDefinitions>
                <RowDefinition Height="22"/>
                <RowDefinition/>
            </Grid.RowDefinitions>

            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Text="{x:Static properties:Globalization.MusicPart_Genre}" VerticalAlignment="Center" FontFamily="Arial Rounded MT" FontSize="13" FontWeight="Bold"/>

			<TextBlock Grid.Row="0" Grid.Column="1" Text="{x:Static properties:Globalization.MusicPart_Artist}" VerticalAlignment="Center" FontFamily="Arial Rounded MT" FontSize="13" FontWeight="Bold"/>

			<TextBlock Grid.Row="0" Grid.Column="2" Text="{x:Static properties:Globalization.MusicPart_Album}" VerticalAlignment="Center" FontFamily="Arial Rounded MT" FontSize="13" FontWeight="Bold"/>

			<ListBox VirtualizingStackPanel.IsVirtualizing="True" ItemsSource="{Binding Source={StaticResource MusicViewGenresDataSource}}" SelectionChanged="lstGenre_SelectionChanged" Grid.Column="0" Grid.Row="1" IsSynchronizedWithCurrentItem="True" x:Name="lstGenre" Margin="1,0,1,0"/>
			<ListBox VirtualizingStackPanel.IsVirtualizing="True" ItemsSource="{Binding Source={StaticResource MusicViewArtistsDataSource}}" SelectionChanged="lstArtist_SelectionChanged" Grid.Column="1" Grid.Row="1" IsSynchronizedWithCurrentItem="True" x:Name="lstArtist" Margin="1,0,1,0"/>
			<ListBox VirtualizingStackPanel.IsVirtualizing="True" ItemsSource="{Binding Source={StaticResource MusicViewAlbumsDataSource}}" SelectionChanged="lstAlbum_SelectionChanged" Grid.Column="2" Grid.Row="1" IsSynchronizedWithCurrentItem="True" x:Name="lstAlbum" Margin="1,0,1,0"/>

		</Grid>

        <!-- Cover flow -->       
        <control:CoverFlow3D x:Name="gvMusic"
                           Margin="2,2,2,2" Grid.Row="1" Visibility="Hidden"
                           ItemSizeFactor="0.15"
                           ItemYOffset ="80"
                           ItemTemplate="{StaticResource CoverDataTemplate}"/>

        <GridSplitter x:Name="gsSplitter" Grid.Row="2" ResizeDirection="Rows" ResizeBehavior="PreviousAndNext" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0,1,0,1" Height="3" Background="{DynamicResource VOColor1A}"/>

        <!-- Data Grid -->
        <dg:DataGrid
            x:Name="xdgMedias"
            Grid.Row="3"
            SelectionMode="Extended"
            SelectionUnit="FullRow"
            ItemsSource="{Binding Source={StaticResource MusicViewContentDataSource}}"
            Background="Transparent"
            RowBackground="Transparent"
            AlternatingRowBackground="{DynamicResource VOColor13}"
            Foreground="{DynamicResource VOColor1A}"
            GridLinesVisibility="None"
            HorizontalGridLinesBrush="Transparent"
            VerticalGridLinesBrush="Transparent"
            RowHeaderWidth="0"
            BorderThickness="0"
            AutoGenerateColumns="False">
            <dg:DataGrid.Columns>
                <dg:DataGridTemplateColumn Header="" MinWidth="20" MaxWidth="20" IsReadOnly="True">
                    <dg:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <wpf:Icon
									Margin="2"
									HorizontalAlignment="Center"
									VerticalAlignment="Center"
									Width="18"
									Height="18"
									Source="{Binding IsPlayingImage}"/>
                        </DataTemplate>
                    </dg:DataGridTemplateColumn.CellTemplate>
                </dg:DataGridTemplateColumn>
                <dg:DataGridTemplateColumn Header="" MinWidth="20" MaxWidth="20" IsReadOnly="True">
                    <dg:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <wpf:Icon
									Margin="2"
									HorizontalAlignment="Center"
									VerticalAlignment="Center"
									Width="18"
									Height="18"
									Source="{Binding IsPresentImage}"/>
                        </DataTemplate>
                    </dg:DataGridTemplateColumn.CellTemplate>
                </dg:DataGridTemplateColumn>
                <dg:DataGridTextColumn Header="{x:Static properties:Globalization.MusicPart_DetailsTitle}" MinWidth="160" Width="SizeToCells"  
                                           Binding="{Binding Title}" 
                                           IsReadOnly="True"/>
                <dg:DataGridTemplateColumn Header="{x:Static properties:Globalization.MusicPart_DetailsRating}" MinWidth="82" MaxWidth="82" IsReadOnly="True">
                    <dg:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                                <StackPanel Orientation="Horizontal">
                                    <ToggleButton IsEnabled="False" IsChecked="{Binding Path=IsRating1, Mode=TwoWay}" Width="14" Height="20" Style="{StaticResource ToggleButton.Star}"/>
                                    <ToggleButton IsEnabled="False" IsChecked="{Binding Path=IsRating2, Mode=TwoWay}" Width="14" Height="20" Style="{StaticResource ToggleButton.Star}"/>
                                    <ToggleButton IsEnabled="False" IsChecked="{Binding Path=IsRating3, Mode=TwoWay}" Width="14" Height="20" Style="{StaticResource ToggleButton.Star}"/>
                                    <ToggleButton IsEnabled="False" IsChecked="{Binding Path=IsRating4, Mode=TwoWay}" Width="14" Height="20" Style="{StaticResource ToggleButton.Star}"/>
                                    <ToggleButton IsEnabled="False" IsChecked="{Binding Path=IsRating5, Mode=TwoWay}" Width="14" Height="20" Style="{StaticResource ToggleButton.Star}"/>
                                </StackPanel>
                        </DataTemplate>
                    </dg:DataGridTemplateColumn.CellTemplate>
                </dg:DataGridTemplateColumn>

                <dg:DataGridTextColumn Header="{x:Static properties:Globalization.MusicPart_DetailsGenre}" MinWidth="80" Width="SizeToCells"  
                                           Binding="{Binding Genre}" 
                                           IsReadOnly="True"/>
                <dg:DataGridTextColumn Header="{x:Static properties:Globalization.MusicPart_DetailsArtist}" MinWidth="120" Width="SizeToCells"  
                                           Binding="{Binding Artist}" 
                                           IsReadOnly="True"/>
                <dg:DataGridTextColumn Header="{x:Static properties:Globalization.MusicPart_DetailsDuration}" MinWidth="80" Width="SizeToCells"  
                                           Binding="{Binding Duration}" 
                                           IsReadOnly="True"/>

            </dg:DataGrid.Columns>
        </dg:DataGrid>

        <!--igDP:XamDataPresenter x:Name="xdgMedias"
							   Grid.Row="3"
							   DataSource="{Binding Source={StaticResource MusicViewContentDataSource}}"
							   IsGroupByAreaExpanded="False"
							   IsNestedDataDisplayEnabled="True"
							   RecordContainerGenerationMode="LazyLoad"
							   GroupByAreaLocation="None"
							   View="{DynamicResource xdpDefaultView}">

			<igDP:XamDataPresenter.FieldLayouts>
				<igDP:FieldLayout>
					<igDP:FieldLayout.Settings>
						<igDP:FieldLayoutSettings HighlightAlternateRecords="True" SelectionTypeRecord="Extended" SelectionTypeField="None" SelectionTypeCell="None" AutoGenerateFields="False" AllowDelete="False"/>
					</igDP:FieldLayout.Settings>
					<igDP:FieldLayout.Fields>
						<igDP:Field Name="IsPlayingImage" Label="">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellMinWidth="20" CellMaxWidth="20" CellWidth="20" LabelWidth="20" LabelMaxWidth="20" LabelMinWidth="20"
																  CellValuePresenterStyle="{DynamicResource xdpIconSourceCellValuePresenter}" CellClickAction="SelectRecord" AllowResize="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:Field Name="IsPresentImage" Label="">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellMinWidth="20" CellMaxWidth="20" CellWidth="20"
																  CellValuePresenterStyle="{DynamicResource xdpIconSourceCellValuePresenter}" CellClickAction="SelectRecord" AllowResize="False" LabelWidth="20" LabelMaxWidth="20" LabelMinWidth="20"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:Field Name="Title" Label="{x:Static properties:Globalization.MusicPart_DetailsTitle}" IsScrollTipField="True">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellClickAction="SelectRecord" CellWidth="160" AllowEdit="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:UnboundField Name="Rating" Label="{x:Static properties:Globalization.MusicPart_DetailsRating}">
							<igDP:UnboundField.Settings>
								<igDP:FieldSettings CellMinWidth="82" CellWidth="82" CellMaxWidth="82" CellValuePresenterStyle="{StaticResource RatingImage}" CellClickAction="SelectRecord" AllowEdit="False"/>
							</igDP:UnboundField.Settings>
						</igDP:UnboundField>
						<igDP:Field Name="Genre" Label="{x:Static properties:Globalization.MusicPart_DetailsGenre}">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellWidth="80" CellClickAction="SelectRecord" AllowEdit="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:Field Name="Artist" Label="{x:Static properties:Globalization.MusicPart_DetailsArtist}">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellWidth="120" CellClickAction="SelectRecord" AllowEdit="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:Field Name="Album" Label="{x:Static properties:Globalization.MusicPart_DetailsAlbum}">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellWidth="300" CellClickAction="SelectRecord" AllowEdit="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
						<igDP:Field Name="Duration" Label="{x:Static properties:Globalization.MusicPart_DetailsDuration}">
							<igDP:Field.Settings>
								<igDP:FieldSettings CellWidth="80" CellClickAction="SelectRecord" AllowEdit="False"/>
							</igDP:Field.Settings>
						</igDP:Field>
					</igDP:FieldLayout.Fields>
				</igDP:FieldLayout>
			</igDP:XamDataPresenter.FieldLayouts>
		</igDP:XamDataPresenter-->

        <!-- Kiosk -->
        <control:Kiosk x:Name="kiosk" Margin="2,2,2,2" Grid.Row="1" Grid.RowSpan="5" Visibility="Hidden"/>

        <!--/Grid-->

        <Grid x:Name="griMusicInfo" Grid.Row="5">
            <Grid.RowDefinitions>
                <RowDefinition Height="18"/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <Border Margin="2,2,2,2" Background="{DynamicResource VOColor11}" CornerRadius="1" Opacity="0.5"/>
            <Button x:Name="btnExpand" Margin="12,2,2,2" Style="{StaticResource Button.Transparent}" HorizontalAlignment="Left">
                <Grid>
                    <wpf:Icon x:Name="imgExpand" HorizontalAlignment="Right" Width="12" Height="12"  Source="/_images/controlpanel/expand.png" Visibility="Collapsed"/>
                    <wpf:Icon x:Name="imgCollapse" HorizontalAlignment="Right" Width="12" Height="12"  Source="/_images/controlpanel/collapse.png"/>
                </Grid>
            </Button>

            <control:MusicInfoControl x:Name="musicInfo" Grid.Row="1"/>
        </Grid>

        <wpf:Spinner x:Name="spinner" Grid.RowSpan="6" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"/>

    </Grid>

</runtime:VisualPart>
